const SelfReadable = require('./self_readable');

function test1() {
    const iterator = function(limit) {
        return {
            "next": function() {
                if (limit--) {
                    return {
                        done: false,
                        value: limit
                    }
                }
                return {
                    done: true
                }
            }
        }
    }(1e10);
    const selfReadable = new SelfReadable(iterator);
    selfReadable.on('data', (data) => process.stdout.write(data));
    selfReadable.on('end', () => process.stdout.write('DONE'));
}


test1();